home *** CD-ROM | disk | FTP | other *** search
- // Dynamic link library implementation of BackTanhAxon with user gain control
-
- #include "NSDLL.h"
-
- /********************************/
- /* Backpropagation of component */
-
- __declspec(dllexport) void performBackLinearAxon(
- DLLData *instance, // Pointer to instance data
- DLLData *dualInstance, // Pointer to the forward axons instance data
- NSFloat *data, // Pointer to the layer of processing elements (PEs)
- int rows, // Number of rows of PEs in the layer
- int cols, // Number of columns of PEs in the layer
- NSFloat *error, // Pointer to the sensitivity vector
- NSFloat *gradient, // Pointer to the bias gradient vector
- NSFloat beta // Slope gain scalar, same for all PEs
- )
-
- {
- int i, length=rows*cols;
- NSFloat gain = getFloatParameter(dualInstance, 2, 1);
-
- for (i=0; i<length; i++) {
- error[i] *= gain*beta*(1.0f - data[i]*data[i] + 0.1f);
- if (gradient)
- gradient[i] += error[i];
- }
- }
-